package cate.game.play.buff.h;

import cate.common.table.d.GD;
import cate.game.attr.FightAttr;
import cate.game.play.buff.BuffHandler;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.fighter.Fighter;
import cate.game.play.proce.action.ctx.ActionCtx;

/**
 * 消失或被驱散后对敌方全体造成（600% + 当前免伤比例）*防御*5的真实伤害。
 */
public class 余震BH extends BuffHandler {

	private double 基础系数;

	private double 比例系数;

	//基础系数=60000&比例系数=5000
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		基础系数 = args.getWDouble("基础系数", 0d);
		比例系数 = args.getWDouble("比例系数", 0d);
	}

	@Override
	public void onInvalid(ActionCtx action, byte invalidReason) {
		FightAttr total = buff.owner.attr.total();
		double damage = (基础系数+total.hurtIgn()/ GD.W_10000_0)*total.defTotal()*比例系数;
		for (Fighter target : action.getTeamVs().getEnemyTeam(buff.owner.getTeam()).getFightersAlive()) {
			target.attr.buffHurt(action, buff.owner, damage);
		}
	}
}
